<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增值日')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-table-add">

            <input name="classId" class="form-control" type="hidden" th:value="${classId}"  required>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">星期几：</label>
                <div class="col-sm-8">
                     <select id="weekDay" name="weekDay" class="form-control select2-multiple" th:with="type=${@dict.getType('sc_week_day')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">组长：</label>
                <div class="col-sm-8">
                    <select id="leaderId" name="leaderId" class="form-control select2-multiple" required>
                        <option th:each="st:${students}" th:value="${st.id}" th:text="${st.studentName}" ></option>
                    </select>
                </div>

            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">组员：</label>
                <div class="col-sm-8">
                    <select id="membersIds" name="membersIds" class="form-control select2-multiple" multiple required>
                        <option th:each="st:${students}" th:value="${st.id}" th:text="${st.studentName}" ></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">备注：</label>
                <div class="col-sm-8">
                   <textarea name="remark" class="form-control" ></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: select2-js" />
    <script type="text/javascript">
        var prefix = ctx + "school/table"
        $("#form-table-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-table-add').serialize());
            }
        }

        $("input[name='createDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        $(function() {
            $('#leaderId').select2({
                placeholder: "请选择组长",
                allowClear: true
            });
            $('#membersIds').select2({
                placeholder: "请选择组员",
                allowClear: true
            });
            $('#weekDay').select2({
                placeholder: "请选择星期",
                allowClear: true
            })
        })

    </script>
</body>
</html>